@@ -49,7 +49,7 @@ android { |
||
49 | 49 |
zipAlignEnabled false |
50 | 50 |
minifyEnabled false |
51 | 51 |
shrinkResources false |
52 |
- buildConfigField "boolean", "isTestMode", "false" |
|
52 |
+ buildConfigField "boolean", "isTestMode", "true" |
|
53 | 53 |
signingConfig signingConfigs.releaseConfig |
54 | 54 |
} |
55 | 55 |
} |
@@ -5,6 +5,7 @@ import android.bluetooth.BluetoothAdapter; |
||
5 | 5 |
import android.bluetooth.BluetoothDevice; |
6 | 6 |
import android.content.Intent; |
7 | 7 |
import android.os.Bundle; |
8 |
+import android.os.Handler; |
|
8 | 9 |
import android.support.annotation.Nullable; |
9 | 10 |
import android.text.TextUtils; |
10 | 11 |
import android.view.View; |
@@ -43,12 +44,15 @@ public class PrinterSettingActivity extends BaseActivity implements PrinterSetti |
||
43 | 44 |
public static final int REQUEST_CONNECT_DEVICE = 3; |
44 | 45 |
|
45 | 46 |
private String qrcode; |
47 |
+ |
|
48 |
+ private Handler myHandler; |
|
49 |
+ |
|
46 | 50 |
@Override |
47 | 51 |
protected void onCreate(@Nullable Bundle savedInstanceState) { |
48 | 52 |
super.onCreate(savedInstanceState); |
49 | 53 |
setContentView(R.layout.activity_printer_setting); |
50 | 54 |
unbinder = ButterKnife.bind(this); |
51 |
- |
|
55 |
+ myHandler = new Handler(); |
|
52 | 56 |
qrcode = getIntent().getStringExtra("qrcode"); |
53 | 57 |
if(TextUtils.isEmpty(qrcode)){ |
54 | 58 |
finish(); |
@@ -71,11 +75,18 @@ public class PrinterSettingActivity extends BaseActivity implements PrinterSetti |
||
71 | 75 |
protected void onResume() { |
72 | 76 |
super.onResume(); |
73 | 77 |
presenter.start(); |
78 |
+ myHandler.postDelayed(new Runnable() { |
|
79 |
+ @Override |
|
80 |
+ public void run() { |
|
81 |
+ presenter.queryPrinterStatus(); |
|
82 |
+ } |
|
83 |
+ },1000); |
|
74 | 84 |
} |
75 | 85 |
|
76 | 86 |
@Override |
77 | 87 |
protected void onDestroy() { |
78 | 88 |
presenter.stop(); |
89 |
+ myHandler.removeCallbacksAndMessages(null); |
|
79 | 90 |
super.onDestroy(); |
80 | 91 |
} |
81 | 92 |
|
@@ -64,7 +64,6 @@ public class PrinterSettingPresenter implements PrinterSettingContract.Presenter |
||
64 | 64 |
view.onBluetoothEnabled(); |
65 | 65 |
view.onPairedDeviceDiscovered(queryPairedDevices()); |
66 | 66 |
discoverNewDevices(); |
67 |
- queryPrinterStatus(); |
|
68 | 67 |
}else{ |
69 | 68 |
view.onBluetoothDisabled(); |
70 | 69 |
view.showToast(context.getString(R.string.bt_is_disabled)); |
@@ -86,6 +85,7 @@ public class PrinterSettingPresenter implements PrinterSettingContract.Presenter |
||
86 | 85 |
view.showToast(context.getString(R.string.printer_status_query_fail)); |
87 | 86 |
return; |
88 | 87 |
} |
88 |
+ view.onPrinterStatusFetched(context.getString(R.string.query_printer_processing)); |
|
89 | 89 |
view.onPrinterStatusFetched(printerService.queryPrinterStatus()); |
90 | 90 |
} |
91 | 91 |
|
@@ -116,7 +116,7 @@ |
||
116 | 116 |
android:layout_width="match_parent" |
117 | 117 |
android:layout_height="match_parent" |
118 | 118 |
android:gravity="center_vertical" |
119 |
- android:text="@string/click_to_query" |
|
119 |
+ android:text="@string/query_printer_processing" |
|
120 | 120 |
android:textColor="@color/dark_grey" |
121 | 121 |
android:textSize="16sp" /> |
122 | 122 |
</LinearLayout> |
@@ -106,6 +106,8 @@ |
||
106 | 106 |
|
107 | 107 |
<string name="click_to_query">点击查询打印机状态</string> |
108 | 108 |
|
109 |
+ <string name="query_printer_processing">正在查询打印机状态...</string> |
|
110 |
+ |
|
109 | 111 |
<string name="go_check_printer">请检查打印机</string> |
110 | 112 |
|
111 | 113 |
<string name="printer_port_open_fail">打印机端口打开失败</string> |